﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HotelResSystem2
{
    public static class RoomRateFactory
    {
        public static RoomRate GetKingRoomRate()
        {
            // Implicitly upcasted to abstract class
            return new RoomRateKing();
        }

        public static RoomRate GetKingRoomRate(double adjustedRoomRate)
        {
            // Implicitly upcasted to abstract class
            return new RoomRateKing(adjustedRoomRate);
        }

        public static RoomRate GetQueenRoomRate()
        {
            // Implicitly upcasted to abstract class
            return new RoomRateQueen();
        }

        public static RoomRate GetQueenRoomRate(double adjustedRoomRate)
        {
            // Implicitly upcasted to abstract class
            return new RoomRateQueen(adjustedRoomRate);
        }

        public static RoomRate GetStudioRoomRate()
        {
            // Implicitly upcasted to abstract class
            return new RoomRateStudio();
        }

        public static RoomRate GetStudioRoomRate(double adjustedRoomRate)
        {
            // Implicitly upcasted to abstract class
            return new RoomRateStudio(adjustedRoomRate);
        }

        public static RoomRate GetSuiteRoomRate()
        {
            // Implicitly upcasted to abstract class
            return new RoomRateSuite();
        }

        public static RoomRate GetSuiteRoomRate(double adjustedRoomRate)
        {
            // Implicitly upcasted to abstract class
            return new RoomRateSuite(adjustedRoomRate);
        }

        public static RoomRate GetRoomRate(string roomRate)
        {
            if (roomRate == null)
            {
                return null;
            }
            switch (roomRate)
            {
                case RoomRateStudio.XML_TAG:
                    return new RoomRateStudio();
                case RoomRateQueen.XML_TAG:
                    return new RoomRateQueen();
                case RoomRateKing.XML_TAG:
                    return new RoomRateKing();
                case RoomRateSuite.XML_TAG:
                    return new RoomRateSuite();
                default:
                    return null;
            }
        }

        public static List<RoomRate> GetRoomRateList()
        {
            List<RoomRate> discountList = new List<RoomRate>();
            discountList.Add(GetKingRoomRate());
            discountList.Add(GetQueenRoomRate());
            discountList.Add(GetStudioRoomRate());
            discountList.Add(GetSuiteRoomRate());

            return discountList;
        }
    }
}
